// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT

import { HorizontalBox, GroupBox, TextEdit } from "std-widgets.slint";
import { GallerySettings } from "../gallery_settings.slint";
import { Page } from "page.slint";

export component TextEditPage inherits Page {
    show-enable-read-only: true;
    title: @tr("TextEdit");
    description: @tr("Similar to LineEdit, but can be used to enter several lines of text. The widget can be imported from \"std-widgets.slint\".");

    HorizontalBox {
        GroupBox {
            title: @tr("Word-Wrap");

            te1 := TextEdit {
                // min-width: 200px;
                text: @tr("This is our TextEdit widget, which allows for editing text that spans over multiple paragraphs.\nFor example this line starts in a new paragraph.\n\nWhen the amount of lines - due to wrapping and number of paragraphs - exceeds the available vertical height, a vertical scrollbar is shown that allows scrolling.\nYou may want to enter a bit of text here then in order to make them visible.");
                placeholder-text: @tr("Add some text");
                wrap: word-wrap;
                enabled: GallerySettings.widgets-enabled;
                read-only: GallerySettings.widgets-read-only;
            }
        }

        GroupBox {
            title: @tr("No-Wrap");
            te2 := TextEdit {
                // min-width: 200px;
                text <=> te1.text;
                wrap: no-wrap;
                enabled: GallerySettings.widgets-enabled;
                read-only: GallerySettings.widgets-read-only;
            }
        }
    }
}
